import {Service} from "adajs";
import CourseList from "./../../../controls/lists/course";
import List from "./../../../controls/lists";
import CourseapDetail from "./../../../controls/detail/courseap";
import CourseShow from "./../../../controls/detail/courseshow";
import CourseNetwork from "./../../../controls/detail/coursenetwork";
import User from "./../../../lib/user";
import TabService from "./../../tabservice";


class LodgeService extends TabService {
	defaultData() {
		let info = null;
		if (!User.isAdmin()) {
			info = {
				tabs: [
					{
						"name": "课程报名", active: true, type: List, option: {
							url: "/api/lgb/app/lgb/courseinfor/queryPage",
							type: CourseList,
							parameter: {}
						}
					},
					{"name": "课程安排", active: false, type: CourseapDetail, option: {}},
					{"name": "风采展示", active: false, type: CourseShow, option: {}},
					{"name": "网络课程", active: false, type: CourseNetwork, option: {}}
				]
			};
		} else {
			info = {
				tabs: [
					{
						"name": "课程报名", active: true, type: List, option: {
							url: "/api/lgb/app/lgb/courseinfor/queryPage",
							type: CourseList,
							parameter: {}
						}
					},
					{"name": "课程安排", active: false, type: CourseapDetail, option: {}},
					{"name": "风采展示", active: false, type: CourseShow, option: {}},
					{"name": "网络课程", active: false, type: CourseNetwork, option: {}}
				]
			};
		}
		this.setTabs(info.tabs);
		return info;
	}

	onupdate(current, data) {
		Object.assign(current, data);
	}
}

export default LodgeService;